/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package practice.de2;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * 
 */
class ThreadRun extends Thread {

    ThreadFunc thrfunc;
    private int increment;

    public ThreadRun(ThreadFunc thrfunc, int Increment) {
        this.thrfunc = thrfunc;
        this.increment = Increment;
    }

    @Override
    public void run() {
        int a = 0;

        for (int i = 0; i < 11; i++) {
            thrfunc.display(a);
            try {
                Thread.sleep(2000);
            } catch (InterruptedException ex) {
                Logger.getLogger(ThreadRun.class.getName()).log(Level.SEVERE, null, ex);
            }
            a += getIncrement();
            if (a > 10) {
                a = 1;
            }
        }
    }

    public int getIncrement() {
        return increment;
    }

    public void setIncrement(int Increment) {
        this.increment = Increment;
    }
}
